package org.edu.prj.langton.lefebvre.impl;


import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;

import org.edu.prj.langton.LangtonEngine;
import org.edu.prj.langton.LangtonGUI;
import org.edu.prj.langton.lefebvre.IHM.Window;

public class Terrain implements LangtonGUI{

	private int widthWindow;
	private int heightWindow;
	private Window m_window;
	private List<LangtonEngine> m_fourmis;

	/**
	 * Constructor
	 */
	public Terrain() {
		// TODO Auto-generated constructor stub
			m_fourmis = new ArrayList<LangtonEngine>(1);		
	}
	
	/**
	 * add a new fourmi at the LangtonEngine list
	 */
	@Override
	public void addFourmi(LangtonEngine arg0) {
		// TODO Auto-generated method stub
		m_fourmis.add(arg0);
	}

	
    @Override
    public void show() {
        show(new Dimension(widthWindow,heightWindow));
    }
    
    /**
     * 
     * @param size
     */
    public void show(Dimension size ) {
        if (m_window == null) {
        	m_window = new Window(m_fourmis.get(0).getState(), size);
        }
    }
    
	
    public void update () {
        m_window.update();
    }

    public Window getM_window() {
		return m_window;
	}
    
    public void setHeightWindow(int heightWindow) {
  		this.heightWindow = heightWindow;
  	}
    public void setWidthWindow(int widthWindow) {
		this.widthWindow = widthWindow;
	}

}
